@extends('master')

@section('title', '职位管理')

@section('content')
<div class="row">
	<div class="col-md-12">
		@include('message')
		<p class="lead">
			职位管理
			<a class="btn btn-info btn-xs" href="<% route('admin.jobs.create') %>">添加新职位</a>
		</p>

	</div>
</div>

<div class="row">
	<div class="col-md-12">
		@if($jobs->count())
		<div class="table-responsive" style="margin-top:10px;background-color:#fff;">
			<table class="table table-hover">
				<thead>
					<tr>
						<th>职位编号</th>
						<th>标题</th>
						<th>类别</th>
						<th>简历申请</th>
						<th>日期</th>
						<th>状态</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
					@foreach($jobs as $job)
					<tr>
						<td>
							<% $job->id %></td>
						<td>
							@if( !$job->status )
							【草稿】
							@endif
							<% $job->name %>
						</td>
						<td>
							<span class="label label-default"><% $job->category->name %></span>
						</td>
						<td>
							<span class="badge"><% $job->resumes->count() %></span>
						</td>
						<td>
							<% $job->created_at->format('Y-m-d') %>
						</td>
						<td>
							@if( !$job->status )
							草稿
							@else
							已发布
							@endif
						</td>
						<td>
                            <% Form::open(array('route' => array('admin.jobs.destroy', $job->id), 'method' => 'DELETE', 'class' => 'delete-form form-inline invisible')) %>
                                <% link_to_route('admin.jobs.edit','编辑',array('id' => $job->id)) %>
                                <button type="submit" class="btn btn-link btn-xs" onclick="if(!confirm('你确定要删除么')){ return false; }">删除</button>
                            <% Form::close() %>
                        </td>
					</tr>
					@endforeach
				</tbody>
				<tfoot>
					<tr>
                        <th>职位编号</th>
						<th>标题</th>
						<th>类别</th>
						<th>简历申请</th>
						<th>日期</th>
						<th>状态</th>
						<th>操作</th>
					</tr>
				</tfoot>
			</table>
		</div>

		@else
		<br />
		<div class="alert alert-warning alert-dismissible" role="alert">
			<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
  			<strong>还没有职位？</strong> 点击上方的“添加新职位”添加吧.
		</div>
		@endif

		<div class="text-center">
			<% $jobs->links() %>
		</div>
	</div>
</div>
@stop